import java.util.Scanner;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 逆袭人生
 * Date: 2024-07-03
 * Time: 10:26
 */


public class homework {
    public static void main12(String[] args) {
        //模拟登陆
        //编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，提示“登录成功”,密码错误， 可以重新输 入，最多输入三次。三次均错，则提示退出程序
        Scanner scanner = new Scanner(System.in);
        int count = 0;
        while (count <= 3) {

        }
    }
    public static void main11(String[] args) {
        //求出0-999之间的所有“水仙花数”并输出。("水仙花数"是指一个三位数，其各位数字的立方和恰好等于该数本身)
        int number = 0;
        int a = 1;//个位
        int b =1;//十位
        int c =1;//百位
        while (number <= 999) {
            if (number > 100) {
                a = number % 100 % 10;
                b = number % 100 / 10;
                c = number / 100;
                if (a * a * a + b * b * b + c * c * c == number) {
                    System.out.println(number);
                }
        }
            number++;
        }
    }


    public static void main10(String[] args) {
        //求两个正整数的最大公约数
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ret = 1 ;
        if (a > b) {
            for (int i = 1; i <= b; i++) {
                if (a % i == 0 && b % i == 0) {
                    ret = i;
                }

            }
        }else {
            for (int i = 1; i <= a; i++) {
                if (a % i == 0 && b % i == 0) {
                    ret = i;
                }
            }
        }
        System.out.println(a+"和"+b+"最大公约数是："+ret);
    }

    public static void main9(String[] args) {
        //输出乘法口诀表
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (j <= i) {
                    if (j == i) {
                        System.out.println(j + "*" + i + "=" + i * j );

                    } else {
                        System.out.print(j + "*" + i + "=" + i * j);
                        System.out.print(" ");
                    }
                }
            }
            
        }
    }
    public static void main8(String[] args) {
        //输出1000-2000之间所有的闰年
        int year = 1000;
        while (year <= 2000) {
            if (year % 100 == 0) {
                if (year % 400 == 0) {
                    System.out.println(year);
                    year++;
                } else {
                    year++;
                }
            } else {
                if (year % 4 == 0) {
                    System.out.println(year);
                    year++;
                } else {
                    year++;
                }
            }
        }
    }
    public static void main7(String[] args) {
        //打印1-100之间所有的素数
        int i = 1;
        System.out.println(2);
        while (i <= 100) {
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    break;
                }
                if (j == i -1) {
                    if (i % j == 0) {
                        break;
                    } else {
                        System.out.println(i);
                    }
                }

            }
            i++;

        }
    }
    public static void main6(String[] args) {
        //判断一个数字是否是素数
        Scanner scanner = new Scanner(System.in);
        int number = scanner.nextInt();
        System.out.println(number);
        for (int i = 2; i <number ; i++) {
            if (number % i == 0) {
                System.out.println("不是素数");
                break;
            }
            if (i == number - 1) {
                if (number % i ==0) {
                    System.out.println("不是素数");
                } else {
                    System.out.println("是素数");
                }
            }
        }
    }
    public static void main5(String[] args) {
        //根据年龄，来打印出当前年龄的人是少年(低于18),青年(19-28),中年(29-55),老年(56岁以上)
        Scanner scanner = new Scanner(System.in);
        int age = scanner.nextInt();
        System.out.println(age);
       if (age > 0) {
           if (age <= 18) {
               System.out.println("少年");
           } else if (age <= 28 ) {
               System.out.println("青年");
           } else if (age <= 55) {
               System.out.println("中年");
           } else {
               System.out.println("老年");
           }
       }
       else {
           System.out.println("请输入正数");
       }
    }
    public static void main4(String[] args) {
        //输出一个整数的每一位，如：123的每一位是3，2，1


    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //读取多个数字
        //打印"X"型图案
        while (scanner.hasNextInt()) {
            int a = scanner.nextInt();
            for (int i = 1; i <= a; i++) {
                for (int j = 1; j <= a; j++) {
                    if (j == a) {

                        if (j == i || j == a - (i - 1)) {
                            System.out.println("*");
                        } else {
                            System.out.println(" ");
                        }
                    } else {
                        if (j == i || j == a - (i - 1)) {
                            System.out.print("*");
                        } else {
                            System.out.print(" ");
                        }
                    }
                }
            }
        }
    }
    public static void main(String[] args) {
        //计算分数的值
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
        float ret = 0;
        for (int i = 1; i <= 100; i++) {
            if (i % 2 == 0) {
                ret += -1 * 1.0 / i;//ret=ret+(-1)/i;
            }else {
                ret += 1 * 1.0 / i;//ret=ret+1/i;
            }
        }
        System.out.println(ret);
    }
    public static void main1(String[] args) {
        //1-100的所有整数中出现多少个数字9
        int number = 1;
        int count = 0;
        while (number != 101){
            if (number / 10 != 0) {
                if ((number % 10) / 9 == 1 ){
                    count++;
                    number++;
                } else if (number / 10 == 9) {
                    count++;
                    number++;
                } else {
                    number++;
                }
            }else {
                if (number / 9 == 1) {
                    count++;
                    number++;
                }else {
                    number++;
                }
            }
        }
        System.out.println(count);
        System.out.println(number);
    }
}
